/*
 * Functions1.cpp
 *
 *  Created on: 2010-03-21
 *      Author: Anthony Varghese
 */
#include <iostream>
using namespace std;

int add1_0(const int p){
	return  p + 1;
}

int add1_1(const int p){
	const int x = p + 1;
	return x;
}

int add1_2(int p){
	p = p + 1;
	return p;
}

int add1_3(const int p, const int q=1){
	return p+q;
}

int main(){
	cout << "This program, Functions1, looks at using in basic C++ functions"
		 << endl << endl;
	/*
	 * First we set up a couple of variables
	 */
	const int x = 1;
	const int y = 10;
	const int z = 20;
	const int w = 30;
	const int v = 40;
	int u = 50;
	const int t = 60;
	int s = 70;

	const int a = add1_0( x );
	const int b = add1_1( y );
	const int c = add1_2( z );
	const int d = add1_3( w );
	const int e = add1_3( w, 1 );
	const int f = add1_3( w, 2 );
	cout << "Print the values of the variables:" << endl;
	cout << "  x:   " << x << endl;
	cout << "  y:   " << y << endl;
	cout << "  z:   " << z << endl;
	cout << "  w:   " << w << endl;
	cout << "  v:   " << v << endl;
	cout << "  u:   " << u << endl;
	cout << "  t:   " << t << endl;
	cout << "  s:   " << s << endl;
	cout << "  a = add1_0(x): " << a << endl;
	cout << "  b = add1_1(y): " << b << endl;
	cout << "  c = add1_2(z): " << c << endl;
	cout << "  d = add1_3(w): " << d << endl;
	cout << "  e = add1_3(w,1): " << e << endl;
	cout << "  f = add1_3(w,2): " << f << endl;

	return 0;
}
